/*
 ============================================================================
 Name        : bai17.c
 Author      : cuongpq
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>

void initFile(){
	FILE *fp;
	fp = fopen("INPUT.TXT",'w');
	fclose(fp);
}

void writeOutput(int kq[10000], int k){
	FILE *pf;
	int i,j;	
	pf = fopen("OUTPUT.TXT","w");
	
	for (i=0; i<=(k/5); i++){
		for (j=1; j<=5; j++) {
			fprintf(pf,"%d  ",kq[i*5 + j]);
		}
		fprintf(pf,"\n");
	}
	
	fclose(pf);
}

int isNguyenTo(int a){
	int i;
	int n;
	n = (int)sqrt(a) + 1;
	for (i=3; i<=n; i++)
		if (a%i == 0) return 0;
	return 1;
}
int rev(int a){
	int i;
	int n = 0;
	
	while (a>0){
		i = a%10;
		if (n == 0) n = i; 
		else n = n*10 + i;
		a = (int)a/10;
	}
	return n;
}
int chiahet(int a, int b){
	int i;
	int n = 0;	
	while (a>0){
		i = a%10;
		if (n == 0) n = i; 
		else n = n + i;
		a = (int)a/10;
	}
	return n%b;
}

void readInput(int a[100][100], int *k){
	FILE *fp;
	int i, j, temp, h;
	fp = fopen("OUTPUT.TXT","r");
	
	h = 0;
	
	for (i = 1; i<=5; i++){
		for (j=1; j<=5; j++) {
			fscanf(fp,"%d",&temp);
			a[i][j] =  temp;
			h++;
		}
	}
	
	*k = h;
	fclose(fp);
}
int main(void) {	
	int k,i,ng,j;		
	int kq[10000];
	int a[100][100];
	readInput(a,&k);
	
	for (i=1; i<=(k/5); i++){
			for (j=1; j<=5; j++) {
				printf("%d  ",a[i][j]);
			}
			printf("\n");
		}
	/**
	k = 0;
	int b = 32;
	for (i=10000; i<=99999; i++){
		if (isNguyenTo(i) == 1){
			ng = rev(i);
			if (isNguyenTo(ng) == 1){
				if (chiahet(i,b) == 0){
					k++;
					kq[k] = i;
				}
			}
		}
	}
	printf("%d",kq[1]);
	writeOutput(kq, k);
	*/
	return 0;
}
